home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / cert / trk3_eg / fmdrgdrp / opt2 / invent.exe / CUST.BAS < prev    next >
Encoding:
BASIC Source File  |  1993-08-20  |  1.1 KB  |  48 lines

  1. 'Array to hold cust forms
  2.  
  3. Const MAX_CUST = 3
  4. Global CustFormItems(MAX_CUST) As FormItem
  5. Global CustForms(MAX_CUST) As CustForm
  6.  
  7. Global CustSchema() As TABLESCHEMA
  8.  
  9. Sub CustOpen (fname As String, tbname As String)
  10.     
  11.     ' Create a new customer form by allocating a form,
  12.     ' setting up tables and passing control to the
  13.     ' form itself.
  14.  
  15.     If Not FormAvail(CustFormItems()) Then
  16.     MsgBox "Cannot open more customer forms"
  17.     Exit Sub
  18.     End If
  19.     
  20.     i% = FormAlloc(CustFormItems())
  21.     CustFormItems(i%).fiFileName = fname
  22.     CustFormItems(i%).fiTable = tbname
  23.  
  24.     Set CustForms(i%) = New CustForm
  25.     CustForms(i%).Show
  26.     CustForms(i%).Caption = "[" + ExtractBase(fname) + "]" + TnameDisp(tbname)
  27.  
  28. End Sub
  29.  
  30. Sub InitCust ()
  31.     
  32.     ' Initialize form structures and define the customer
  33.     ' field layout
  34.  
  35.     FormInit CustFormItems()
  36.  
  37.     ReDim CustSchema(2)
  38.  
  39.     CustSchema(1).tsName = "CustNo"
  40.     CustSchema(1).tsType = DB_LONG
  41.     
  42.     CustSchema(2).tsName = "CustName"
  43.     CustSchema(2).tsType = DB_TEXT
  44.     CustSchema(2).tsSize = 80
  45.  
  46. End Sub
  47.  
  48.